package com.gameguru.mathgame;
import android.app.Activity;
import android.os.Bundle;
import android.os.CountDownTimer;
import android.widget.ImageView;
import android.widget.TextView;

public class CountDown extends Activity {
	ImageView imageView;
	TextView textView;
	int counter = 1;
	public void onCreate(Bundle bundle) {
		super.onCreate(bundle);
		setContentView(R.layout.count_down);
		textView = (TextView)findViewById(R.id.textView1);		
		MyCount count = new MyCount(4000, 1000);
		count.start();
	}
	public void closeThisActivity(){
		this.setResult(RESULT_OK, null);
		this.finish();
	}

	 class MyCount extends CountDownTimer {

		public MyCount(long millisInFuture, long countDownInterval) {
			super(millisInFuture, countDownInterval);			
		}

		@Override
		public void onFinish() {
			//textView.setText("onFinish");
			//closeThisActivity();
		}

		@Override
		public void onTick(long millisUntilFinished) {			
			switch (counter) {
			case 1:
				textView.setText(R.string.ready);
				break;
			case 2:
				textView.setText(R.string.steady);
				break;
			case 3:
				textView.setText(R.string.go);
				closeThisActivity();
				break;
			}
			counter++;
			
		}
		 
	 }
}
